import request from '@/utils/request'

// 新增班级
export function createClass(data) {
  return request({
    url: '/class/create',
    method: 'post',
    data: data
  })
}

// 获取班级列表
export function getClassList(query) {
  return request({
    url: '/class/list',
    method: 'get',
    params: query
  })
}

// 用户根据班级id获取详情
export function getClassById(id) {
  return request({
    url: `/class/${id}`,
    method: 'get',
  })
}

// 修改班级
export function updateClassById(params) {
  return request({
    url: `/class/update/${params.id}`,
    method: 'put',
    data: params
  })
}

// 用户根据班级id删除
export function deleteClassById(id) {
  return request({
    url: `/class/delete/${id}`,
    method: 'delete'
  })
}



// 指定网关写入名称
export function xbmConvert(query){
  return request({
    url: '/xbm/convert',
    method: 'get',
    params: query
  })
}

// 班级-网关-批量分配手环
export function getClassGwSetWb(query) {
  return request({
    url: '/class/setStuWb',
    method: 'get',
    params: query
  })
}

//班级-网关-批量写姓名
export function getClassGwSetName(query) {
  return request({
    url: '/xbm/xbmToMqtt',
    method: 'get',
    params: query
  })
}

// 网关-闪灯
export function getClassGwControlLed(data) {
  return request({
    url: '/mqtt/toGwControl',
    method: 'post',
    data: data
  })
}

// 班级-清除学生列表
export function delCStudentByCId(class_id) {
  return request({
    url: `/student/delete/selectAll/${class_id}`,
    method: 'delete'
  })
}

// 班级-学生列表-批量删除学生
export function delCStudentSelected(data) {
  return request({
    url: `/student/delete/selected`,
    method: 'post',
    data: data
  })
}

// 班级-学生列表-删除指定学生
export function delCStudent(id) {
  return request({
    url: `/student/delete/${id}`,
    method: 'delete',
  })
}